﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.Services.SheepMale.Domain.PurchaseSales;
using S.Services.SheepMale.Read.Api.Application.ReadCommand.ReadSheepMaleCommand;

namespace S.Services.SheepMale.Read.Api.Controllers
{
    /// <summary>
    /// 期初读取管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ReadSheepController : ControllerBase
    {
        private readonly IMediator mediator;

        public ReadSheepController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 种公期初显示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> HandleShowSheep([FromQuery] ShowFatherCommand request, CancellationToken cancellationToken)
        {
            return Ok(await mediator.Send(request));
        }
        /// <summary>
        /// 种公期初反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> HandleGetSheep([FromQuery] GetFatherCommand request, CancellationToken cancellationToken)
        {
            
            return Ok(await mediator.Send(request));
        }
        /// <summary>
        /// 种母期初反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> HandleGetMom([FromQuery] GetMomCommand request, CancellationToken cancellationToken)
        {
            return Ok(await mediator.Send(request));
        }
        /// <summary>
        /// 种母期初显示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> HandleShowMom([FromQuery] ShowMomCommand request, CancellationToken cancellationToken)
        {
            return Ok(await mediator.Send(request));
        }
    }
}
